SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

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

    buttons or functions don't work

    First, I donít know why my cords donít work. Which is wrong?

    Second, I need 8 same functions, in here I only display 4 funtions, dw_regular(), dw_tab(), fa_regular() and fa_tab(). I want to write a constructor instead of the 8 functions, but the n and slicePath are variable in the Array(n). How can I hand it in the constructor?

    Please help.

    <script language="JavaScript">
    var Mslide = new Array(n)
    var Mtext = new Array(n)
    function control_arrowUp()
    {
    if (document.form_annota.annotation_on=true & document.form_button.dw=true)
    document.form_arrow.up = dw_tab.arrow_up()
    if (document.form_annota.annotation_off=true & document.form_button.dw=true)
    document.form_arrow.up = dw_regular.arrow_up()
    if (document.form_annota.annotation_on=true & document.form_button.fa=true)
    document.form_arrow.up = fa_tab.arrow_up()
    if (document.form_annota.annotation_off=true & document.form_button.fa=true)
    document.form_arrow.up = fa_regular.arrow_up()
    }//control_arrowUp()
    function control_arrowDown()
    {
    if (document.form_annota.annotation_on=true & document.form_button.dw=true)
    document.form_arrow.down = dw_tab.arrow_down()
    if (document.form_annota.annotation_off=true & document.form_button.dw=true)
    document.form_arrow.down = dw_regular.arrow_down()
    if (document.form_annota.annotation_on=true & document.form_button.fa=true)
    document.form_arrow.down = fa_tab.arrow_down()
    if (document.form_annota.annotation_off=true & document.form_button.fa=true)
    document.form_arrow.down = fa_regular.arrow_down()
    }//control_arrowDown()
    //1. dw regular
    function dw_regular()
    {
    var n=38;
    var sliceStep=0
    var infoStep=0
    var slicepath="E14/IMAGES/e14_dw_r_"
    var msname="dw"
    this.arrow_up= arrow_up;
    this.arrow_down= arrow_down;
    function M_image()
    {
    do{
    if (sliceStep<0 )
    Mslide[sliceStep]="../ready.jpg"
    if (sliceStep>=0 )
    Mslide[sliceStep]=slicePath + "00" + sliceStep + ".jpg"
    if (sliceStep>=10)
    Mslide[sliceStep]=slicePath + "0" + sliceStep + ".jpg"
    if (sliceStep>=100)
    Mslide[sliceStep]=slicepath + sliceStep + ".jpg"
    return Mslide[sliceStep]
    sliceStep=sliceStep+1
    }
    while ( sliceStep<Mslide.length )
    }

    function M_textinfo()
    {
    do{
    if (infoStep<0)
    Mtext[infoStep]=msname + "slice: to begin."
    if (infoStep>=0)
    Mtext[infoStep]=msname + "slice:" + infoStep + "."
    if (infoStep>=38)
    Mtext[infoStep]= "End slice."
    return Mtext[infoStep]
    infoStep=infoStep + 1
    }
    while (infoStep<Mtext.length || infoStep>0)
    }
    //arrow down function
    function arrow_down(){
    if (sliceStep>=0)
    {
    window.status=''
    sliceStep=sliceStep- 1
    document.images.slideshow.src=M_image(sliceStep);
    infoStep=infoStep- 1
    document.texts.description.value=M_textinfo(infoStep);
    }
    }
    //arrow up function
    function arrow_up(){
    if (sliceStep<Mslide.length-1)
    { sliceStep=sliceStep+1
    document.images.slideshow.src=M_image(sliceStep);
    infoStep=infoStep+1
    document.texts.description.value=M_textinfo(infoStep);
    }
    }//arrow up
    }//dw_regular()
    //2. dw tab
    function dw_tab()
    {
    var n=8;
    var sliceStep=0
    var infoStep=0
    var slicepath="../../tabImage/E14/dw/e14_ge_"
    var msname="dw"
    this.arrow_up= arrow_up;
    this.arrow_down= arrow_down;
    function M_image()
    {
    do{
    if (sliceStep<0 )
    Mslide[sliceStep]="../ready.jpg"
    if (sliceStep>=0 )
    Mslide[sliceStep]=slicePath + "00" + sliceStep + ".jpg"
    if (sliceStep>=10)
    Mslide[sliceStep]=slicePath + "0" + sliceStep + ".jpg"
    if (sliceStep>=100)
    Mslide[sliceStep]=slicepath + sliceStep + ".jpg"
    return Mslide[sliceStep]
    sliceStep=sliceStep+1
    }
    while ( sliceStep<Mslide.length )
    }
    function M_textinfo()
    {
    do{
    if (infoStep<0)
    Mtext[infoStep]=msname + "slice: begin..."
    if (infoStep>=0)
    Mtext[infoStep]=msname + "slice:" + infoStep + "."
    if (infoStep>=23)
    Mtext[infoStep]= "End."
    return Mtext[infoStep]
    infoStep=infoStep + 1
    }
    while (infoStep<Mtext.length || infoStep>0)
    }
    //arrow down function
    function arrow_down(){
    if (sliceStep>=0)
    {
    window.status=''
    sliceStep=sliceStep- 1
    document.images.slideshow.src=M_image(sliceStep);
    infoStep=infoStep- 1
    document.texts.description.value=M_textinfo(infoStep);
    }
    }
    //arrow up function
    function arrow_up(){
    if (sliceStep<Mslide.length-1)
    { sliceStep=sliceStep+1
    document.images.slideshow.src=M_image(sliceStep);
    infoStep=infoStep+1
    document.texts.description.value=M_textinfo(infoStep);
    }
    }//arrow up
    }//dw_tab
    //3. fa regular
    function fa_regular()
    {
    var n=50;
    var sliceStep=0
    var infoStep=0
    var slicepath="../MS_E14/IMAGES/e14_xf_hj_"
    var msname="fa"
    this.arrow_up= arrow_up;
    this.arrow_down= arrow_down;
    function M_image()
    {
    do{
    if (sliceStep<0 )
    Mslide[sliceStep]="../ready.jpg"
    if (sliceStep>=0 )
    Mslide[sliceStep]=slicePath + "00" + sliceStep + ".jpg"
    if (sliceStep>=10)
    Mslide[sliceStep]=slicePath + "0" + sliceStep + ".jpg"
    if (sliceStep>=100)
    Mslide[sliceStep]=slicepath + sliceStep + ".jpg"
    return Mslide[sliceStep]
    sliceStep=sliceStep+1
    }
    while ( sliceStep<Mslide.length )
    }
    function M_textinfo()
    {
    do{
    if (infoStep<0)
    Mtext[infoStep]=msname + "slice: begining of the part one slices."
    if (infoStep>=0)
    Mtext[infoStep]=msname + "slice:" + infoStep + "."
    if (infoStep>=38)
    Mtext[infoStep]= "End of the part one slice."
    return Mtext[infoStep]
    infoStep=infoStep + 1
    }
    while (infoStep<Mtext.length || infoStep>0)
    }
    //arrow down function
    function arrow_down(){
    if (sliceStep>=0)
    {
    window.status=''
    sliceStep=sliceStep- 1
    document.images.slideshow.src=M_image(sliceStep);
    infoStep=infoStep- 1
    document.texts.description.value=M_textinfo(infoStep);
    }
    }
    //arrow up function
    function arrow_up(){
    if (sliceStep<Mslide.length-1)
    { sliceStep=sliceStep+1
    document.images.slideshow.src=M_image(sliceStep);
    infoStep=infoStep+1
    document.texts.description.value=M_textinfo(infoStep);
    }
    }//arrow up
    }//fa_regular()
    //4. fa tab
    function fa_tab()
    {
    var n=10;
    var sliceStep=0
    var infoStep=0
    var slicepath="../../E14/fa/e14_nm_vb_"
    var msname="fa"
    this.arrow_up= arrow_up;
    this.arrow_down= arrow_down;
    function M_image()
    {
    do{
    if (sliceStep<0 )
    Mslide[sliceStep]="../re.jpg"
    if (sliceStep>=0 )
    Mslide[sliceStep]=slicePath + "00" + sliceStep + ".jpg"
    if (sliceStep>=10)
    Mslide[sliceStep]=slicePath + "0" + sliceStep + ".jpg"
    if (sliceStep>=100)
    Mslide[sliceStep]=slicepath + sliceStep + ".jpg"
    return Mslide[sliceStep]
    sliceStep=sliceStep+1
    }
    while ( sliceStep<Mslide.length )
    }

    function M_textinfo()
    {
    do{
    if (infoStep<0)
    Mtext[infoStep]=msname + "slice: begining of the part one slices."
    if (infoStep>=0)
    Mtext[infoStep]=msname + "slice:" + infoStep + "."
    if (infoStep>=23)
    Mtext[infoStep]= "End of the part one slice."
    return Mtext[infoStep]
    infoStep=infoStep + 1
    }
    while (infoStep<Mtext.length || infoStep>0)
    }
    //arrow down function
    function arrow_down(){
    if (sliceStep>=0)
    {
    window.status=''
    sliceStep=sliceStep- 1
    document.images.slideshow.src=M_image(sliceStep);
    // document.write(M_image(DWslide[sliceStep]))
    infoStep=infoStep- 1
    document.texts.description.value=M_textinfo(infoStep);
    }
    }
    //arrow up function
    function arrow_up(){
    if (sliceStep<Mslide.length-1)
    { sliceStep=sliceStep+1
    document.images.slideshow.src=M_image(sliceStep);
    // document.write(M_image(Mslide[sliceStep]))
    infoStep=infoStep+1
    document.texts.description.value=M_textinfo(infoStep);
    }
    }//arrow up
    }//fa_tab()
    </script>
    </head>

    <body>
    <p>&nbsp;</p>
    <td width="241" align="left" valign="bottom"><div align="left">
    <p><font color="#FF0000" size="4"><strong>Indext</strong></font></p>
    </div>

    </td>
    <td width="142" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
    </tr>
    <tr>
    <td height="365" colspan="2" align="center" valign="middle"><img src="MS_E14/IMAGES/e14_dw_hor_000.jpg" name="slideshow" width="470" height="334"></td>
    <td align="center" valign="top">
    <p align="center">&nbsp;</p>
    <p align="center">&nbsp;</p>
    <p align="center">&nbsp;</p>
    <p align="center">&nbsp;</p>
    <script language ="javascript">
    // <p align="center"><img src="../upButton.gif" onClick="control_arrowUp()" width="19" height="24"></p>
    // <p align="center"><img src="../downButton.gif" onClick="control_arrowDown()" width="19" height="24"></p></td>
    </script>
    <form name="form_arrow" method="post" action="">
    <input type="button" name="up" value="<-" onClick="control_arrowUp()">
    <input type="button" name="down" value="->" onClick="control_arrowDown()">
    </form>
    </tr>
    <tr>
    <td height="37" colspan="2" align="center" valign="middle">
    <form name="texts" action="" method="post" id="texts">
    <div align="center">
    <input name="description" type="text" size="50">
    </div>
    </form></td>
    <td rowspan="2" align="center" valign="middle"><strong>Annotation </strong>
    <form name="form_annota" method="post" action="">
    <input name="annotation_on" type="button" onClick="return true" id="annotation_on" value="Annotation On ">
    <input name="annotation_off" type="button" onClick="return true" id="annotation_off" value="Annotation Off ">
    </form></td>
    </tr>
    <tr>
    <td height="47" colspan="2" align="center" valign="middle">
    <form name="form_button" method="post" action="">
    <input name="dw" type="button" onClick="if(form_annota.annotation_off=true){dw_origin()} else{(form_annota.annotation_on=true){dw_tab()}" value=" DW ">
    <input name="fa" type="button" onClick="if(form_annota.annotation_off=true){fa_origin()} else{(form_annota.annotation_on=true){fa_tab()}" value=" Fa ">
    </form></td>
    </tr>
    </table>
    <p align="center">&nbsp;</p>
    </div>
    </body>
    </html>

  2. #2
    SitePoint Member f0kin's Avatar
    Join Date
    Jul 2007
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the first thing that can be highlighted is that
    u are using operator "=" instead of comparison operator "=="
    too often....

  3. #3
    SitePoint Member
    Join Date
    Jun 2007
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You are right. No prompt of error in this time to test when I have changed these operators into comparison operators. Thank you so much.

    But it still doesn't work, any help please!


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
  •