SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Jul 2007
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    (javascript)dynamic value to variable in src

    Hi talents..

    well.. i am new to javascript itself..

    i am creating a project in facelet, there i need to use javascript code within my project..
    like..
    <script type="text/javascript" src="http://<sitename>?var1=a&var2=aa">
    </script>
    like this.....

    here i want to give a value a to the variable var1 dynamically...

    that is, based on the first page result, the value ll changed as a (or) b (or) c....... like that..

    now i dont know what to do..

    please help me..
    what should i need to change in my coding..
    and how can i give dynamic value to the variable..

  2. #2
    SitePoint Zealot the DtTvB's Avatar
    Join Date
    Jul 2006
    Location
    Thailand
    Posts
    162
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This method may be better.

    Code:
    <script type="text/javascript">
    var1 = 'a';
    var2 = 'aa';
    </script>
    <script type="text/javascript" src="http://<sitename>"></script>

  3. #3
    SitePoint Member
    Join Date
    Jul 2007
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thank you for your support..

    but.. i have tried that too..

    may its because, i am using this script code inside the rih faces in facelet (.xhmtl) file..

    can you help me now how to do..

    my sample coding as follows,

    <rich:tabPanel switchType="client">
    <rich:tab label="First">
    </rich:tab>
    <rich:tab label="second">
    <script language="javascript" src="http://sitename&var1=a&var2=aa" type="text/javascript">
    </script>
    </rich:tab>
    </rich:tabPanel>

    Thank you for your response rajug..
    and here i need to send those variable and values to that site.. then only it will display the result..
    while trying this idea, that variable was unassigned and giving only default page of that website..

    telling you clearly,
    if i set the var1 as cellphone it will displays the pages related to cellphones..
    please help me now..
    Last edited by alexrozario; Jul 13, 2007 at 01:42. Reason: add some more details

  4. #4
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    <rich:tabPanel switchType="client">
    <rich:tab label="First">
    </rich:tab>
    <rich:tab label="second">
    <script language="javascript" type="text/javascript">
    var var1 = 'a';
    var var2 = 'b';
    </script>
    <script language="javascript" src="http://sitename" type="text/javascript">
    </script>
    </rich:tab>
    </rich:tabPanel>
    And those two variables declared here can use in your included javascript file as usual.

    Does this help you?
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5


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
  •