Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Jan 2004
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Javascript and quoting

    When you use a writeln() or write() command, we all know how to work with strings.

    Basically, if you want java to write the HTML equavlent of, say:
    <table color="red">

    you would write:
    document.writeln("<table color='red'>");

    but now, I need to write out this line:
    <select name="Gnetwork" onchange="MM_jumpMenu('parent',this,0)">

    How would I run it through as a writeln command? (because theres already ' ' characters)

    document.writeln("<select name='Gnetwork' onchange='MM_jumpMenu(?parent?,this,0)'>");

    what would I replace the ?'s with?
    Last edited by Raraken; 04-30-2004 at 09:38 PM.

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    How I'd do it:

    Code:
    document.writeln("<select name=\"Gnetwork\" onchange=\"MM_jumpMenu('parent',this,0)\">");
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #3
    Registered User
    Join Date
    Apr 2004
    Posts
    99
    Thanks
    0
    Thanked 0 Times in 0 Posts

    heh

    i just spent about 4 days trying to figure this out (for a couple languages) and in javascript:

    no diff, as long as they come in pairs - in theory... but in praxis most folks (from what they tell me) follow a double with a single (first in first out) like
    Code:
     "somefunction('argstring')"
    - since it is returning a string, it must have one or the other.

    if it's not returning a string, it cannot have either.

    for example "somefunction(this)" or "somefunction(obj)" would be fine

    i really don't know my head from a hole in the ground in re: script, but i think this info's right since it just happened and i'm just mumming the guys that know what they're doing (on this board).

    without using roy's suggested slash method, i think it would be this (but i'm not sure):

    Code:
    document.writeln("<select name='Gnetwork' onchange='MM_jumpMenu(parent,this,0)'>");
    i'm too lazy to look it up at the moment, but not more than a week ago i had a thread on this topic where brothercake and glenngv broke it down pretty clearly (cos i'm stupid ). gl.

    edit: punctuation.
    Last edited by immedicable; 05-01-2004 at 12:29 PM.

  • #4
    Regular Coder
    Join Date
    Apr 2004
    Location
    Canada
    Posts
    302
    Thanks
    2
    Thanked 0 Times in 0 Posts
    I believe that you can use character entities:

    Code:
    <select name="Gnetwork" onchange="MM_jumpMenu(&#038;#039;parent&#038;#039;,this,0)">
    If you wanted to surround parent in double quotes, you would use the character #034; or quot;

  • #5
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Quote Originally Posted by Roy Sinclair
    How I'd do it:

    document.writeln("<select name=\"Gnetwork\" onchange=\"MM_jumpMenu('parent',this,0)\">");
    But I prefer this:

    document.writeln('<select name="Gnetwork" onchange="MM_jumpMenu(\'parent\',this,0)">');
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________


  •  

    Posting Permissions

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