SitePoint Sponsor

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 25 of 35
  1. #1
    SitePoint Addict
    Join Date
    Feb 2012
    Location
    Kiwi in Bangkok
    Posts
    373
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help with this code problem please

    Hello, my first posting

    I have uploaded a script and all is well, except this!

    On one web page is a word "Select" when clicked on it should open a list

    Yet it is dead, when the mouse is over is it reads: javascript:;

    I used :Inspect Element with Firebug" to locate the "Select" corresponding code

    <tr class="c1">
    <td width="150" align="right"></td>
    <td class="contentfont" colspan="2"><span id="main_category_display"><?=$main_category_display;?></span>
    [ <a href="javascript:;" onClick="select_category(document.getElementById('category_id').value, 'main_category_field', 'main_', false, true, 'wanted');"><?=GMSG_SELECT;?></a> ]</td>
    </tr>

    your help greatly appreciated

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by RayWilk View Post
    On one web page is a word "Select" when clicked on it should open a list

    Yet it is dead, when the mouse is over is it reads: javascript:;
    Get rid of the "javascript:" part - that's doing you no favours at all.

    The standard way to prevent the default behaviour (of following a link) from occurring when you click on one, is to return false from the event.

    Code:
    <a href="#javascript:;" onClick="select_category(document.getElementById('category_id').value, 'main_category_field', 'main_', false, true, 'wanted'); return false;"><?=GMSG_SELECT;?></a>
    A way to further improve on that, is to remove the scripting that is embedded within the HTML content, and move the scripting to the end of the body instead.
    This can be easily achieved by giving the link a unique identifier, so that scripting can then more easily access it.

    HTML Code:
    <a id="select" href="#"><?=GMSG_SELECT;?></a>
    Code javascript:
    document.getElementById('select').onclick = function () {
        select_category(document.getElementById('category_id').value, 'main_category_field', 'main_', false, true, 'wanted');
        return false;
    }
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Addict
    Join Date
    Feb 2012
    Location
    Kiwi in Bangkok
    Posts
    373
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello Paul

    many thank yous, for you help with this,

    ok I did your first suggestion, removed "javascript;" and saved the file

    I know have

    <a href= onClick="select_category(document.getElementById('category_id').value, 'main_category_field', 'main_', false, true);"><?=GMSG_SELECT;?></a></td>

    when I go to the site page and hover over "Select" I see

    http://trade.comeze.com/onClick="select_category(document.getElementById('category_id').value,

    and clicking on "Select causes my hosters main page to load

    what should I do now?

    I see you are a Kiwi. I am also, from Auckland

    your help greatly appreciated

    Ray

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by RayWilk View Post
    what should I do now?
    Let me repeat what I mentioned before.

    Code:
    <a href="#javascript:;" onClick="select_category(document.getElementById('category_id').value, 'main_category_field', 'main_', false, true, 'wanted'); return false;"><?=GMSG_SELECT;?></a>
    The green is to be added, the red is to be removed.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  5. #5
    SitePoint Addict
    Join Date
    Feb 2012
    Location
    Kiwi in Bangkok
    Posts
    373
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello Paul, thank you.

    I have edited the code and saved it as you have here, (copied from your reply)

    <a href="#" onClick="select_category(document.getElementById('category_id').value, 'main_category_field', 'main_', false, true, 'wanted'); return false;"><?=GMSG_SELECT;?></a>

    now with my mouse over the "Select" word I see

    http://trade.comeze.com/sell_item.php and when clicked nothing happens

    your help and patience appreciated

    Ray

  6. #6
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by RayWilk View Post
    when clicked nothing happens
    Oh something happens alright, it's just that you can't tell what is happening without looking at the network traffic.

    A request gets made from the select_category() function to the following link:
    http://trade.comeze.com/ajax_files/select_category.php?category_id=&target_box_id=main_category_field&prefix=main_&reverse_categories=false&click_select=true&listing_type=wanted

    But the select_category.php file doesn't seem to exist.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  7. #7
    SitePoint Addict
    Join Date
    Feb 2012
    Location
    Kiwi in Bangkok
    Posts
    373
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Paul,

    ok I got a bit confused yet have it sorted correctly now,

    there are 2 php page files that have the "Select" word on them: sell_item_details-tpl.php & wanted_manage.tpl.php

    in my 1st post I gave you the 'wanted' script, then proceeded to paste your new script into the sell php page,

    got my head together now

    <a href="#" onClick="select_category(document.getElementById('category_id').value, 'main_category_field', 'main_', false, true, 'wanted'); return false;"><?=GMSG_SELECT;?></a>

    the above 'wanted' corrected by you saved into the wanted_manage.tpl.php

    results mouse hover over gives me: http://trade.comeze.com/wanted_manage.php# and nothing visible happening when clicked

    if it would help you to access my site or any files then I am happy to email you the Log In details

    thank you again

    Ray PS: having problems with sitepoint Log IN, using Firefox, yet says I must re-Log In You do not have permission to perform this action. Please refresh the page and login before trying again.

  8. #8
    SitePoint Addict
    Join Date
    Feb 2012
    Location
    Kiwi in Bangkok
    Posts
    373
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Paul

    yes I do not have a select_category.php, but I have a category_selector.php

    so I renamed the category_selector.php to select_category.php, and loaded in my files on the hoster,

    yet no change to the "Select" behavior

    I have 2 versions of this script, I looked in both, neither have a select_category.php

    all ideas appreciated

    Ray

  9. #9
    SitePoint Addict
    Join Date
    Feb 2012
    Location
    Kiwi in Bangkok
    Posts
    373
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello Paul

    I have been looking over the code on my site, and using Inspect Element with Firebug, I looked at the code on another site using the same or similar script ( his is working )

    My code: (original code from my script)

    [ <a href="javascript:;" onClick="select_category(document.getElementById('category_id').value, 'main_category_field', 'main_', false, true);"><?=GMSG_SELECT;?></a>
    ]
    </td>


    His Code: (using Firebug)(this code works correctly when "Select" is clicked)

    [
    <a onclick="select_category(document.getElementById('category_id').value, 'main_category_field', 'main_', false, true, 'auction', document.getElementById('list_in').value);" href="javascript:;">Select</a>
    ]
    </td>

    I tried using his code to replace mine and saving it, yet it did not work,

    Ray

  10. #10
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by RayWilk View Post
    I have been looking over the code on my site, and using Inspect Element with Firebug, I looked at the code on another site using the same or similar script ( his is working )
    As said before, the problem you have now is not directly to do with JavaScript scripting. Your problem is that the required PHP file cannot be found.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  11. #11
    SitePoint Addict
    Join Date
    Feb 2012
    Location
    Kiwi in Bangkok
    Posts
    373
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Paul

    thank you,

    I am doing some research on this missing php file, why? where? how?

    I will get back to you when I know more

    thank you again for all your help

    best wishes

    Ray

  12. #12
    SitePoint Addict
    Join Date
    Feb 2012
    Location
    Kiwi in Bangkok
    Posts
    373
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Paul,

    ok I have had some good fortune

    I was looking at older versions of my script when I saw this,

    <a href="javascript:;" onClick="openPopup('<?=SITE_PATH;?>category_selector.php?cat=category_id&category_id=<?=$item_details['category_id'];?>&auction_id=<?=$item_details['auction_id'];?>&form_name=ad_create_form')">
    <?=GMSG_MODIFY;?></a>

    with: category_selector.php

    so I pasted it in, saved it, and Yes it works, when the "Select" is clicked a Pop Up window opens showing the Categories for selection.

    so now could you help me integrate both lines, as the older versions had a Popup, yet now a small in the page window should open,
    .......................................
    [<a href="javascript:;" onClick="openPopup('<?=SITE_PATH;?>category_selector.php?cat=category_id&category_id=<?=$item_details['category_id'];?>&auction_id=<?=$item_details['auction_id'];?>&form_name=ad_create_form')">
    <?=GMSG_SELECT;?></a>]
    ......................................
    [<a href="javascript:;" onClick="category_selector(document.getElementById('addl_category_id').value, 'addl_category_field', 'addl_', false, true, 'wanted');"><?=GMSG_SELECT;?></a>]
    ......................................

    your help greatly appreciated

    Ray

  13. #13
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by RayWilk View Post
    so now could you help me integrate both lines, as the older versions had a Popup, yet now a small in the page window should open
    I don't think that it is possible to get the second one working until you can resolve the issue with is attempting to access the file called select_category.php
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  14. #14
    SitePoint Addict
    Join Date
    Feb 2012
    Location
    Kiwi in Bangkok
    Posts
    373
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Paul,

    ok I understand you, I am beginning to understand the php functions

    the Pop Up windows works well, so I will stay with that

    another question: I would like to increase the text size on my site pages, so they load with a slightly larger size font,

    where do I go to adjust this ? and how ?

    your help appreciated


  15. #15
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by RayWilk View Post
    another question: I would like to increase the text size on my site pages, so they load with a slightly larger size font,

    where do I go to adjust this ? and how ?
    By adjusting the font size in your CSS file.

    The people in the CSS forum will be best able to help you with the best way of doing that.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  16. #16
    SitePoint Addict
    Join Date
    Feb 2012
    Location
    Kiwi in Bangkok
    Posts
    373
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Paul,

    ok I will look at the CSS file and contact the CSS forum,

    a fast reply! just awake here, 6.32 am Bangkok time

  17. #17
    SitePoint Addict
    Join Date
    Feb 2012
    Location
    Kiwi in Bangkok
    Posts
    373
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Paul,

    a question:

    if I have the line: <?=GMSG_SELECT;?></a>]</td> then only the word "Select" is displayed on the web page.

    but if I have the line: <?=GMSG_SELECT_MAIN_CATEGORY;?></a>]</td> then all the words "GMSG_SELECT_MAIN_CATEGORY" is displayed on the web
    page.

    how to stop the GMSG from displaying?


  18. #18
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by RayWilk View Post
    if I have the line: <?=GMSG_SELECT;?></a>]</td> then only the word "Select" is displayed on the web page.

    but if I have the line: <?=GMSG_SELECT_MAIN_CATEGORY;?></a>]</td> then all the words "GMSG_SELECT_MAIN_CATEGORY" is displayed on the web
    page.

    how to stop the GMSG from displaying?
    That's PHP which is doing everything with the <?=...?> so you'll be able to gain the best assistance with that from our PHP forum.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  19. #19
    SitePoint Addict
    Join Date
    Feb 2012
    Location
    Kiwi in Bangkok
    Posts
    373
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Paul,

    just when I thought I had it sorted, the popup script for the wanted.php works well, but when placed in the sell_details.php does not,

    so manage.php page calls the PopUp, yet sell_details.php does not,

    could you have a look please, see what you see,

    ..................................................................

    <td width="150" align="right"></td>
    <td class="contentfont" colspan="2"><span id="main_category_display"><?=$main_category_display;?></span>

    [<a href="javascript:;" onClick="openPopup('<?=SITE_PATH;?>category_selector.php?cat=category_id&category_id= <?=$item_details['category_id'];?>&auction_id=<?=$item_details['auction_id'];?>&form_name=ad_create_form')">
    <?=GMSG_SELECT;?></a>]</td>

    </tr>
    <tr class="c2" id="main_category_box">
    <td></td>
    <td id="main_category_field" colspan="2"></td>
    </tr>
    <tr class="reguser">
    <td></td>
    <td colspan="2"><?=MSG_CATEGORY_CHANGE_NOTE;?></td> (wanted-working)

    .....................................................................................

    <td width="150" align="right"></td>
    <td class="contentfont">
    <span id="main_category_display"><?=$main_category_display;?></span>

    [ <a href="javascript:;" onClick="openPopup('<?=SITE_PATH;?>category_selector.php?cat=category_id&category_id=<?=$item_details['category_id'];?>&auction_id=<?=$item_details['auction_id'];?>&form_name=ad_create_form')">
    <?=GMSG_SELECT;?></a> ]

    </td>
    </tr>
    <tr class="c2" id="main_category_box">
    <td></td>
    <td id="main_category_field"></td> (sell-not working)
    .............................................................................................

  20. #20
    SitePoint Addict
    Join Date
    Feb 2012
    Location
    Kiwi in Bangkok
    Posts
    373
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Paul,

    to let you know I solved the problem, by pasting the PopUp Java script code into the sell_details.php

    thank you for all your help


  21. #21
    billycundiff{float:left;} silver trophybronze trophy RyanReese's Avatar
    Join Date
    Oct 2008
    Location
    Whiteford, Maryland, United States
    Posts
    13,721
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    Good job . Makes sense though, if the page doesn't have the Javascript to cause the popup, then it won't .
    Always looking for web design/development work.
    http://www.CodeFundamentals.com

  22. #22
    SitePoint Addict
    Join Date
    Feb 2012
    Location
    Kiwi in Bangkok
    Posts
    373
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Paul,

    I am hoping you can help me with this,

    Photos are not uploading in the Sell section

    Is it a Host problem or a website problem?

    Is there some way to finding out?

    your help always appreciated

    Ray

  23. #23
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by RayWilk View Post
    Is it a Host problem or a website problem?

    Is there some way to finding out?
    Yes there is. You can investigate on the server-side what is happening with that.
    It's possible that the PHP forum forum can help with that, and the Server configuration forum can also help in terms of finding out logging info on the server that can help to track down the issue.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  24. #24
    SitePoint Addict
    Join Date
    Feb 2012
    Location
    Kiwi in Bangkok
    Posts
    373
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you Paul

    your help greatly appreciated

  25. #25
    SitePoint Addict
    Join Date
    Feb 2012
    Location
    Kiwi in Bangkok
    Posts
    373
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello Paul,

    this is in regards to my photos not uploading

    On my Wanted Ads page, I select a file in "Browse" to upload, Clicked upload, then left clicked on "Browse" to show using Inspect Element with Firebug.

    this is what I see:

    <tr class="c1">
    <input id="nb_uploads_1" type="hidden" value="0" name="nb_uploads_1">
    <td align="right" nowrap="">Upload File</td>
    <td>
    <div id="div_file_1">
    <input id="item_file_upload_1" type="file" onchange="upload_media_async(ad_create_form, 1, this.form.item_file_upload_1, document.getElementById('item_file_url_1').value, document.getElementById('item_file_embed_1').value, document.getElementById('nb_uploads_1').value, 4, 'W_39');" style="width: 250px;" name="item_file_upload_1">
    </div>
    </td>
    <td></td>

    I can not see any mention of the selected file: C:\Documents and Settings\XP Vienna\Desktop\Ray scans\1a.jpg

    so I reloaded the Wanted Ads page and this time pasted the URL into the upload area, (C:\Documents and Settings\XP Vienna\Desktop\Ray scans\1a.jpg)

    Clicked upload, went to Firebug, the same as above.

    should I be seeing the C:\Documents and Settings\XP Vienna\Desktop\Ray scans\1a.jpg in the Firebug script?

    all help appreciated


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •