Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Javascript function problem

  • 03-08-2005 12:20PM
    #1
    Registered Users, Registered Users 2 Posts: 3,012 ✭✭✭


    Ok,

    not much of a JavaScript man, but have to redesign a search tool on a website, that's done in it.
    I have it all worked out, and working except for one function, that I need to flip through pages of results.

    Here's the code:
     function function_NextPage(place, type, input)
    {
    	var left_table = "searchresultLeft.html?place="+place+"&choice="+type+"&content="+input;
     	parent.frame_dataLeft.location.href = left_table;
    }
    
    ................................................
    
       document.write("<form><input type='button' value='Next Page' onClick='function_NextPage('00"+i+"','name','"+Input+"')'></form>");
    

    I dont need to be told the problems with frames, or a language that can do it better than JS, cause I dont have a choice as to how it's done.

    At the moment the button does nothing, but I do know that the values of i and Input are correct.

    If anyone could tell me why it doesn't work, I'd really appretiate it.

    Cheers.


Comments

  • Registered Users, Registered Users 2 Posts: 68,173 ✭✭✭✭seamus


    The problem seems to lie with your quotation marks as far as I can see. When you're using the onClick value for example, your can't mix your quotes. SO you need to use one type of quote for the value declaration (e.g. onClick="..."), and another type of quote within the Javascript inside these quotes. When the browser reads a second double (or single) quote inside the javascript, it treats that as the end of the onClick value declaration, so you get an error.
    Try
    document.write("<form><input type='button' value='Next Page' onClick=\"function_NextPage('00"+i+"','name','"+Input+"')\"></form>");
    Let me know if it works.


  • Registered Users, Registered Users 2 Posts: 3,012 ✭✭✭BizzyC


    Worked a treat.

    Cheers Dude.


Advertisement