473,407 Members | 2,312 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

link at TOP of page

hi,

for some reason my ONE or TWO a href link (determined by the javascript) will not appear at the top of my page. it appears on the side next to the PHP output. can someone tell me how to amend my code?

Expand|Select|Wrap|Line Numbers
  1. <html>
  2.  
  3.  
  4. <STYLE type="text/css">
  5. ....
  6. </STYLE>
  7.  
  8.  
  9. <SCRIPT LANGUAGE="JavaScript">
  10.    function FRESHEN() 
  11.  { 
  12.    window.location.reload()
  13. }
  14. </SCRIPT>
  15.  
  16. </head>
  17.  
  18.  
  19. <BODY onload="showLoc();">
  20.  
  21.  
  22. <?php
  23. $count=$_GET['count'];
  24. $fac= strtoupper($_GET['fac']);
  25. $SRG_GROUP=$_GET['SRG_GROUP'];
  26. ?>
  27.  
  28. <br>
  29.  
  30.  
  31. <?php
  32.  
  33. echo "<a name=top></a><br>";
  34. echo "<A HREF='javascript:javascript:history.go(-1)'>HOME</A><br><br>";
  35.  
  36. print "<span style='color: #008b8b; font-size: 12pt; font-family: arial'><b>";
  37.  
  38. echo $count;
  39. echo "<br>";
  40. print "</b></span>";
  41. print "<span class='style17'><font face = 'arial' size = '1'>";
  42. echo $fac;
  43. echo "<br>";
  44. echo $SRG_GROUP;
  45. echo "<br><br>";
  46. print "</font></span>";
  47.  
  48.  
  49. $conn=odbc_connect('ERVOLUMES','','');
  50. if (!$conn)
  51.   {exit("Connection Failed: " . $conn);}
  52.  
  53. $sql="SELECT [patient account number] AS patient_account_number, dischargeday, hospitalcode, age, [discharge time] AS discharge_time FROM 1_shift WHERE SRG_GROUP = '".$SRG_GROUP."' AND hospitalcode LIKE '".$fac."' AND admitday ='".$count."'";
  54.  
  55. $rs=odbc_exec($conn,$sql);
  56.  
  57. print "<hr size = 1 width = 400 align = left color = #666666>";
  58. print "<span style='color: #008b8b; font-size: 10pt; font-family: arial'><b>";
  59. echo "details <br>";
  60. print "</b></span>";
  61.  
  62.  
  63. echo "<br><table width = '500' height = '10' align = 'left' border = '0'>";
  64. echo "<tr height = '10'>";
  65. echo "<td width = '100' height = '10'><b>ADMIT DAY</b></td>";
  66. echo "<td width = '100' height = '10'><b>AGE</b></td>";
  67. echo "<td width = '100' height = '10'><b>DISCH DAY</b></td>";
  68. echo "<td width = '100' height = '10'><b>PT ACCT#</b></td>";
  69. echo "<td width = '100' height = '10'><b>DISCH TIME</b></td>";
  70. echo "</tr>";
  71. echo "</table><br>";
  72. echo "<br><table width = '500' height = '10' align = 'left' border = '0'>";
  73.  
  74.  
  75. if (!$rs)
  76.   {exit("Error in SQL");}
  77. while (odbc_fetch_row($rs))
  78. {
  79.  
  80.  
  81.   $DISDAY=odbc_result($rs, dischargeday);
  82.   $AGE=odbc_result($rs, age);
  83.   $PTACCTNO=odbc_result($rs, patient_account_number);
  84.   $DISCHTIME=odbc_result($rs, discharge_time);
  85.  
  86.  
  87. echo "<tr height = '10'>";
  88. echo "<td width = '100' height = '10'>$count</td>";
  89. echo "<td width = '100' height = '10'>$AGE</td>";
  90. echo "<td width = '100' height = '10'>$DISDAY</td>";
  91. echo "<td width = '100' height = '10'>$PTACCTNO</td>";
  92. echo "<td width = '100' height = '10'>$DISCHTIME</td>";
  93. echo "</tr>";
  94.  
  95. $DISCHTIME<br>";
  96.  
  97.  
  98. }
  99.  
  100.  
  101.  
  102. echo "<tr height = '10'>";
  103. echo "<td width = '100' height = '10'><br><a href='#top' onClick='FRESHEN()'>back to top</a></td>";
  104. echo "<td width = '100' height = '10'>";
  105.  
  106.  
  107.  
  108. echo "<SCRIPT LANGUAGE='JavaScript'>";
  109. echo "   function showLoc() ";
  110. echo " { ";
  111. echo "   var x = window.location.hash; ";
  112. echo "if (x == '#top')"; 
  113. echo "{ ";
  114. echo "document.body.innerHTML += '<a href=\'javascript:javascript:history.go(-2)\'>TWO</a>';";
  115. echo "}";
  116. echo "else";
  117. echo "{";
  118. echo "document.body.innerHTML += '<a href=\'javascript:javascript:history.go(-1)\'>ONE</a>';";
  119. echo "}";
  120. echo "}";
  121. echo "</SCRIPT>";
  122.  
  123.  
  124. echo "</td>";
  125. echo "<td width = '100' height = '10'></td>";
  126. echo "<td width = '100' height = '10'></td>";
  127. echo "<td width = '100' height = '10'><b></td><br>";
  128. echo "</tr>";
  129.  
  130.  
  131. echo "</table><br><br><br>";
  132.  
  133.  
  134.  
  135. ?>
  136.  
  137.  
  138.  
  139.  
  140. </html>
  141.  
thanks in advance,
geebee
Jan 22 '09 #1
22 2475
Markus
6,050 Expert 4TB
There's a few links in there. Could you be more specific please?
Jan 22 '09 #2
Dormilich
8,658 Expert Mod 8TB
before I answer the question, the code needs some cleanup.
- you don't need an echo/print in every line.
this will do:
Expand|Select|Wrap|Line Numbers
  1. echo "<div>
  2. <p>$text_1</p>
  3. <p>$text_2</p>
  4. </div>";
- do not put spaces around the =, that's not valid HTML (though browsers are forgiving) (... and always quote the value)
Expand|Select|Wrap|Line Numbers
  1. <element attribute="value"/>
- <font> tags are deprecated, CSS is much better suited for that task

**************
if you want to use innerHTML, you need to apply CSS to achieve that. e.g. position: absolute;

the better way is to use DOM to put the links where you want them.

insert an element with an ID (say, "links") where you want the links to appear
Expand|Select|Wrap|Line Numbers
  1. <span id="links"></span>
now create the new links
Expand|Select|Wrap|Line Numbers
  1. // creating a link
  2. var link = document.createElement("a");
  3. // define link's attributes & content ... comes here
  4. // attaching link to the document
  5. // get helper element
  6. var temp = document.getElementById("links");
  7. // add the links
  8. temp.parentNode.insertBefore(link, temp); // requires DOM level 2 support
  9. // delete helper element (if you wish)
  10. temp.parentNode.removeChild(temp);
Jan 22 '09 #3
i want the link specified in lines 114 and 118 to appear at the top of the page. Right now they are appearing at the right side of the PHP output.

thanks in advance,
geebee
Jan 22 '09 #4
in my CSS:

Expand|Select|Wrap|Line Numbers
  1. A:LINK, A:VISITED{color:#6699cc;text-decoration:none;}
  2.         A:HOVER{text-decoration:underline;color:#CCCCCC;}
  3.  
do i just amend the A:LINK part for the innerhtml for the position to be absolute?

or do i add a whole new line to the CSS part?

thanks in advance,
geebee
Jan 22 '09 #5
Dormilich
8,658 Expert Mod 8TB
@geraldjr30
you probably need more than one line, like
Expand|Select|Wrap|Line Numbers
  1. a { // <= this will affect ALL links
  2.     position: absolute;
  3.     top: ... ;
  4.     left: ... ; // or right
  5. // other styling
  6. }
Jan 22 '09 #6
now i have in my CSS:

Expand|Select|Wrap|Line Numbers
  1. a { 
  2.     position: absolute; 
  3.     top: 5 ; 
  4.     left: 10 ; // or right 
  5.  
i only want this to affect the links in either line 114 or 118, and the other links to be absolute (where i put them in the code). how can i make it to where it doesnt affect all links? add another piece in CSS like a2?

thanks in advance,
geebee
Jan 22 '09 #7
Dormilich
8,658 Expert Mod 8TB
put a class on those links and apply the CSS to the class. and values in CSS must always have their units attached (em, ex, pt, px, ...) (except 0, where the unit doesn't matter)

note: remove the comment, it will make trouble
Jan 22 '09 #8
the "back to top", "HOME", "ONE" (or "TWO") links are appearing on top of one another now in the top left hand corner of the page...

Expand|Select|Wrap|Line Numbers
  1. <html>
  2.  
  3.  
  4. <STYLE type="text/css">
  5.         TD{font-family:ARIAL;font-size:12px;color:#666666;}
  6.         BODY{font-family:ARIAL;font-size:11px;color:#666666;background-color:#ffffff;margin-top:40px;margin-bottom:0px;margin-left:40px;margin-right:0px;}
  7.         FORM{display:inline;}    
  8.         A:LINK, A:VISITED{color:#6699cc;text-decoration:none;}
  9.         A:HOVER{text-decoration:underline;color:#CCCCCC;}
  10.         .HOMETEXT{font-size:14px;}
  11.         .ITEMNAME{font-size:14px;font-weight:BOLD;}
  12.         /*.WHITELINK{color:#ffffff;font-size:10px;}*/
  13.         .INPUT{border-color:#66CCFF;border-width:1px;border-style:solid;background-color:#eeeeee;font-size:10px;}
  14.         .INPUT2{background-image:url(webtd_grass_matrix_pic4.jpg);color:#666666;border-top:1px solid #BBBBBB;border-bottom:1px solid #BBBBBB;border-right:1px solid #BBBBBB; border-left:1px solid #BBBBBB; font-family:copperplate gothic light;font-size:7pt;}
  15.         .BUTTON{border-color:#99CCFF;border-width:1px;border-style:solid;}
  16.         .BOLD{color:#666666;font-family:Arial, Tahoma, Helvetica, sans-serif;font-size:8pt;font-weight:BOLD;}
  17.         .BOLDLARGE{color:#666666;font-size:12pt;font-weight:BOLD;}
  18.         .CURRENTPAGE{color:#666666;font-size:8pt;font-weight:BOLD;}
  19.         .ERROR{color:#cc0033;font-size:8pt;font-weight:BOLD;}
  20.         .MENUCELL{height:24px;width:80px;text-align:center;font-weight:BOLD;color:#FFFFFF;border-top:1px solid #BBBBBB;border-bottom:1px solid #BBBBBB;border-right:1px solid #BBBBBB;}
  21.         .MENUCELLSTART{height:24px;width:80px;border:1px solid #BBBBBB;text-align:center;font-weight:BOLD;color:#FFFFFF;}
  22.         .SPACE1{padding-left:20px;}
  23.         .BORDER{background-color:#EEEEEE;color:#666666;border-top:1px solid #BBBBBB;border-bottom:1px solid #BBBBBB;border-right:1px solid #BBBBBB;height:24px;padding-left:16px;}
  24.         .BORDER1{border-bottom:1px solid #BBBBBB;}
  25.         .BORDER2{background-color:#EEEEEE;color:#666666;border:1px solid #BBBBBB;}
  26.         .BORDER3{background-color:#000000;color:#666666;border-top:1px solid #ffffff;border-bottom:1px solid #ffffff;border-right:1px solid #ffffff;height:44px;padding-left:16px;}
  27.         .HEADER{background-color:#EEEEEE;color:#666666;border:1px solid #BBBBBB;height:24px;font-weight:BOLD;padding-left:20px;}
  28.         .PRODCELL{border-left:1px solid #BBBBBB;border-bottom:1px solid #BBBBBB;background-color:#FFFFFF;}
  29.         .HEADER1{background-color:#EEEEEE;color:#666666;border-left:1px solid #BBBBBB;border-top:1px solid #BBBBBB;border-bottom:1px solid #BBBBBB;height:24px;font-weight:BOLD;padding-left:20px;}
  30.         .HEADER5{width:130px;color:#666666;background-color:#EEEEEE;border-top:1px solid #BBBBBB;border-right:1px solid #BBBBBB;height:24px;}
  31.         .PRODIMGLGCELL{width:300px;height:295px;background-color:#EEEEEE;border-left:1px solid #BBBBBB;border-right:1px solid #BBBBBB;border-bottom:1px solid #BBBBBB;vertical-align:top;text-align:center;}
  32.         .PRODIMGSMCELL{width:130px;height:125px;background-color:#EEEEEE;border-left:1px solid #BBBBBB;border-right:1px solid #BBBBBB;border-bottom:1px solid #BBBBBB;vertical-align:top;text-align:center;}
  33.         .PRODIMGSM{border:1px solid white;height:120px;width:120px;align:middle;}
  34.         .PRODIMGLG{border:1px solid #BBBBBB;height:290px;width:290px;align:middle;}
  35.         .CATIMG{width:120px;height:120px;border:1px solid #BBBBBB;}
  36.         .stylegreyblue {color: #669999}
  37.         .stylelightblue {color: ##DEE7F7}
  38.         .styleblack {color:#000000}
  39.         .stylegreyblack {color:#444444}
  40.         .styledarkpink {color: #990033}
  41.         .styleslateblue {color: #008b8b}
  42.         .stylewhite {color: #ffffff}
  43.         .input.btn {color:#666666; font: bold small 'trebuchet ms',helvetica,sans-serif; 
  44.         background-color: #eeeeee;
  45.         border:1px solid;   
  46.         border-color: #66CCFF #66CCFF #66CCFF #66CCFF; 
  47.         font-size:11px; 
  48.         }  
  49.  
  50. a { 
  51.     position: absolute; 
  52.     top: 5pt ; 
  53.     left: 10pt ; 
  54.  
  55. a2 { 
  56.     position: absolute; 
  57.     top: 40pt ; 
  58.     left: 40pt ; 
  59.  
  60.  
  61. .style17 {color: #666666}
  62. .style18 {color: #CC6699}
  63. .style19 {color: #CCCCCC}
  64. .style22 {font-family: Verdana; color: #CCCCCC;}
  65. .style23 {color: #66CCFF}
  66. .style24 {
  67.     color: #99FF66;
  68.     font-weight: bold;
  69. }
  70. .style26 {color: #99FF66}
  71. .style27 {color: #999999}
  72. .stylered {color: #FF0000}
  73. .stylegreen {color: #00FF00}
  74.  
  75. </STYLE>
  76.  
  77.  
  78.  
  79. <SCRIPT LANGUAGE="JavaScript">
  80.    function FRESHEN() 
  81.  { 
  82.    window.location.reload()
  83. }
  84. </SCRIPT>
  85.  
  86.  
  87. </head>
  88.  
  89.  
  90.  
  91.  
  92. <BODY onload="showLoc();">
  93.  
  94.  
  95.  
  96.  
  97.  
  98. <?php
  99. $count=$_GET['count'];
  100. $fac= strtoupper($_GET['fac']);
  101. $SRG_GROUP=$_GET['SRG_GROUP'];
  102. ?>
  103.  
  104.  
  105.  
  106.  
  107.  
  108. <br>
  109.  
  110.  
  111.  
  112. <?php
  113.  
  114. #echo $_SERVER['REQUEST_URI']
  115.  
  116. #echo "<a href = 'COUNTTEST.php'>HOME</a><br><br>";
  117.  
  118. echo "<a name=top></a><br>";
  119.  
  120. echo "<A HREF='javascript:javascript:history.go(-1)' span class='a2'>HOME</A><br><br>";
  121.  
  122.  
  123.  
  124.  
  125.  
  126. print "<span style='color: #008b8b; font-size: 20pt; font-family: arial'><b>";
  127.  
  128. echo $count;
  129. echo "<br>";
  130. print "</b></span>";
  131. print "<span class='style17'><font face = 'arial' size = '1'>";
  132. echo $fac;
  133. echo "<br>";
  134. echo $SRG_GROUP;
  135. echo "<br><br>";
  136. print "</font></span>";
  137.  
  138.  
  139. $conn=odbc_connect('ERVOLUMES','','');
  140. if (!$conn)
  141.   {exit("Connection Failed: " . $conn);}
  142.  
  143. $sql="SELECT [patient account number] AS patient_account_number, dischargeday, hospitalcode, age, [discharge time] AS discharge_time FROM 1_shift WHERE SRG_GROUP = '".$SRG_GROUP."' AND hospitalcode LIKE '".$fac."' AND admitday ='".$count."'";
  144.  
  145.  
  146. $rs=odbc_exec($conn,$sql);
  147.  
  148. print "<hr size = 1 width = 400 align = left color = #666666>";
  149. print "<span style='color: #008b8b; font-size: 10pt; font-family: arial'><b>";
  150. echo "details <br>";
  151. print "</b></span>";
  152.  
  153.  
  154. echo "<br><table width = '500' height = '10' align = 'left' border = '0'>";
  155. echo "<tr height = '10'>";
  156. echo "<td width = '100' height = '10'><b>ADMIT DAY</b></td>";
  157. echo "<td width = '100' height = '10'><b>AGE</b></td>";
  158. echo "<td width = '100' height = '10'><b>DISCH DAY</b></td>";
  159. echo "<td width = '100' height = '10'><b>PT ACCT#</b></td>";
  160. echo "<td width = '100' height = '10'><b>DISCH TIME</b></td>";
  161. echo "</tr>";
  162. echo "</table><br>";
  163.  
  164. echo "<br><table width = '500' height = '10' align = 'left' border = '0'>";
  165.  
  166.  
  167. if (!$rs)
  168.   {exit("Error in SQL");}
  169. while (odbc_fetch_row($rs))
  170. {
  171.  
  172.  
  173.   $DISDAY=odbc_result($rs, dischargeday);
  174.   $AGE=odbc_result($rs, age);
  175.   $PTACCTNO=odbc_result($rs, patient_account_number);
  176.   $DISCHTIME=odbc_result($rs, discharge_time);
  177.  
  178.  
  179.  
  180. echo "<tr height = '10'>";
  181. echo "<td width = '100' height = '10'>$count</td>";
  182. echo "<td width = '100' height = '10'>$AGE</td>";
  183. echo "<td width = '100' height = '10'>$DISDAY</td>";
  184. echo "<td width = '100' height = '10'>$PTACCTNO</td>";
  185. echo "<td width = '100' height = '10'>$DISCHTIME</td>";
  186. echo "</tr>";
  187.  
  188.  
  189.  
  190.  
  191. #echo $count;
  192. #echo "&nbsp &nbsp $AGE &nbsp $DISDAY &nbsp $PTACCTNO &nbsp $DISCHTIME<br>";
  193.  
  194.  
  195. }
  196.  
  197.  
  198.  
  199. echo "<tr height = '10'>";
  200. echo "<td width = '100' height = '10'><br><a href='#top' span class='a2'onClick='FRESHEN()'>back to top</a></td>";
  201. echo "<td width = '100' height = '10'>";
  202.  
  203.  
  204.  
  205. echo "<div align = 'right'><SCRIPT LANGUAGE='JavaScript'>";
  206. echo "   function showLoc() ";
  207. echo " { ";
  208. echo "   var x = window.location.hash; ";
  209. echo "if (x == '#top')"; 
  210. echo "{ ";
  211. echo "document.body.innerHTML += '<a href=\'javascript:javascript:history.go(-2)\' span class='a'>TWO </a>';";
  212. echo "}";
  213. echo "else";
  214. echo "{";
  215. echo "document.body.innerHTML += '<a href=\'javascript:javascript:history.go(-1)\' span class='a'>ONE</a>';";
  216. echo "}";
  217. echo "}";
  218. echo "</SCRIPT></div>";
  219.  
  220.  
  221. echo "</td>";
  222. echo "<td width = '100' height = '10'></td>";
  223. echo "<td width = '100' height = '10'></td>";
  224. echo "<td width = '100' height = '10'><b></td><br>";
  225. echo "</tr>";
  226.  
  227.  
  228. echo "</table><br><br><br>";
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235. ?>
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249. </html>
  250.  
not sure what to do now... forgive my bad writing... still learning this PHP


thanks in advance,
geebee
...
Jan 22 '09 #9
Dormilich
8,658 Expert Mod 8TB
@geraldjr30
yea... kind of expected that, try to remove the left property. after all it would be better to place the links right to begin with....

hey, what about this: place the link where you want it and make javascript set the text and attribute right?

@geraldjr30
PHP is not your problem here.........
Jan 22 '09 #10
hey, what about this: place the link where you want it and make javascript set the text and attribute right?

could you give me an example of using the javascript to set the attribute to left? especially my "ONE" and "TWO" links, which appear in PHP?

thanks in advance,
geebee
Jan 22 '09 #11
Markus
6,050 Expert 4TB
Moving to html/css
Jan 22 '09 #12
Dormilich
8,658 Expert Mod 8TB
@geraldjr30
simplified example:
Expand|Select|Wrap|Line Numbers
  1. // html, place it where you want it to be
  2. <a id="link">ONE</a>
  3.  
  4. // Javascript
  5. var a = document.getElementById("link");
  6. a.addEventListener("click", go_back_1, false);
  7. // go_back_1 & go_back_2 are functions defined elsewhere
  8. if (window.location.hash == "...")
  9. {
  10.     a.firstChild.nodeValue = "TWO";
  11.     a.removeEventListener("click", go_back_1, false);
  12.     a.addEventListener("click", go_back_2, false);
  13. }
Jan 22 '09 #13
drhowarddrfine
7,435 Expert 4TB
btw, there's no such thing as:
<SCRIPT LANGUAGE="JavaScript">

Should be:
<script type="text/javscript">
Jan 22 '09 #14
hi,

i am new to javascript...

i now have

Expand|Select|Wrap|Line Numbers
  1.  
  2. <SCRIPT LANGUAGE="text/JavaScript">
  3.    function go_back_1() 
  4.  { 
  5.    document.body.innerHTML += "<a href=\"http://www.AOL.com\">AOL</a>";
  6. }
  7. </SCRIPT>
  8.  
  9.  
  10.  
  11. <SCRIPT LANGUAGE="text/JavaScript">
  12.    function go_back_2() 
  13.  { 
  14.   document.body.innerHTML += "<a href=\"http://www.msn.com\">MICROSOFT</a>";
  15. }
  16. </SCRIPT>
  17.  
  18.  
  19.  
  20. </head>
  21.  
  22.  
  23.  
  24.  
  25. <BODY onload="showLoc2();">
  26.  
  27.  
  28.  
  29.  
  30. <a id="link">ONE</a> 
  31.  
  32.  
  33.  
  34.  
  35. <SCRIPT LANGUAGE="text/JavaScript"> 
  36. function showLoc2() 
  37. var a = document.getElementById("link"); 
  38. a.addEventListener("click", go_back_1, false); 
  39. if (window.location.hash == "#top") 
  40.     a.firstChild.nodeValue = "MICROSOFT"; 
  41.     a.removeEventListener("click", go_back_1, false); 
  42.     a.addEventListener("click", go_back_2, false); 
  43. </SCRIPT>
  44.  
"ONE" is appearing at the tope of the page, but the AOL or MICROSOFDT links are not appearing at all. and the url in the address bar is suffixed with "#top".

not sure what im doing wrong.

thanks in advance,
geebee
Jan 23 '09 #15
Dormilich
8,658 Expert Mod 8TB
@geraldjr30
of course, you put it there ... and you didn't mention an AOL link anywhere... I was referring to your first code.

go_back_1 & go_back_2 were intended to be the history functions (hence the names)
Expand|Select|Wrap|Line Numbers
  1. function go_back_1()
  2. {
  3.      history.go(-1);
  4. }
the body.innerHTML property will do no good here.

@geraldjr30
you need that to trigger window.location.hash.
Jan 23 '09 #16
here is what i have now... i must be still missing something somewhere...

Expand|Select|Wrap|Line Numbers
  1. <SCRIPT LANGUAGE="text/JavaScript">
  2.    function FRESHEN() 
  3.  { 
  4.    window.location.reload();
  5. }
  6. </SCRIPT>
  7.  
  8.  
  9.  
  10. <SCRIPT LANGUAGE="text/JavaScript">
  11.    function go_back_1() 
  12.  { 
  13.    history.go(-1); 
  14. }
  15. </SCRIPT>
  16.  
  17.  
  18.  
  19. <SCRIPT LANGUAGE="text/JavaScript">
  20.    function go_back_2() 
  21.  { 
  22.   history.go(-2); 
  23. }
  24. </SCRIPT>
  25.  
  26.  
  27.  
  28.  
  29. <SCRIPT LANGUAGE="text/JavaScript"> 
  30. function showLoc2() 
  31. var a = document.getElementById("link"); 
  32. a.addEventListener("click", go_back_1, false); 
  33. if (window.location.hash == "#top") 
  34.     a.firstChild.nodeValue = "TWO"; 
  35.     a.removeEventListener("click", go_back_1, false); 
  36.     a.addEventListener("click", go_back_2, false); 
  37. </SCRIPT>
  38.  
  39.  
  40. </head>
  41.  
  42.  
  43.  
  44.  
  45. <BODY onload="showLoc2();">
  46.  
  47.  
  48.  
  49.  
  50.  
  51. <a id="link">ONE</a>  
  52.  
  53.  
  54.  
  55.  
  56. <?php
  57. $count=$_GET['count'];
  58.  
ONE is being listed at the top of the page, but it doesnt appear to be a link.. just a word.

thanks in advance,
geebee
Jan 23 '09 #17
Dormilich
8,658 Expert Mod 8TB
@geraldjr30
that's because it doesn't bear a href attribute. use the id to attach some appropriate styling (the cursor property will come in handy for that)
Jan 23 '09 #18
ok... same code as my previous post with the exception of line 53:

Expand|Select|Wrap|Line Numbers
  1. <a href id="link">ONE</a>  
  2.  
i am assuming that the javascript code i had in the previous post is supposed to change this link with ID name of "link"? if so, im just not sure how its supposed to do this and what more i am missing.

thanks in advance,
geebee
Jan 23 '09 #19
Dormilich
8,658 Expert Mod 8TB
@geraldjr30
what the code does is following: with the regular url go back 1 history entry when clicked, with extended url (url + #top) change the text to TWO and go back 2 history entries when clicked .

that's what you had in your first post (and when I tried it myself, it worked)

regards
Jan 23 '09 #20
exactly what code worked for you? weve gone back and forth several times and i must have gotten confused... here is what i now have?

Expand|Select|Wrap|Line Numbers
  1. <html>
  2.  
  3.  
  4. <STYLE type="text/css">
  5.         TD{font-family:ARIAL;font-size:12px;color:#666666;}
  6.         BODY{font-family:ARIAL;font-size:11px;color:#666666;background-color:#ffffff;margin-top:40px;margin-bottom:0px;margin-left:40px;margin-right:0px;}
  7.         FORM{display:inline;}    
  8.         A:LINK, A:VISITED{color:#6699cc;text-decoration:none;}
  9.         A:HOVER{text-decoration:underline;color:#CCCCCC;}
  10.         .HOMETEXT{font-size:14px;}
  11.         .ITEMNAME{font-size:14px;font-weight:BOLD;}
  12.         /*.WHITELINK{color:#ffffff;font-size:10px;}*/
  13.         .INPUT{border-color:#66CCFF;border-width:1px;border-style:solid;background-color:#eeeeee;font-size:10px;}
  14.         .INPUT2{background-image:url(webtd_grass_matrix_pic4.jpg);color:#666666;border-top:1px solid #BBBBBB;border-bottom:1px solid #BBBBBB;border-right:1px solid #BBBBBB; border-left:1px solid #BBBBBB; font-family:copperplate gothic light;font-size:7pt;}
  15.         .BUTTON{border-color:#99CCFF;border-width:1px;border-style:solid;}
  16.         .BOLD{color:#666666;font-family:Arial, Tahoma, Helvetica, sans-serif;font-size:8pt;font-weight:BOLD;}
  17.         .BOLDLARGE{color:#666666;font-size:12pt;font-weight:BOLD;}
  18.         .CURRENTPAGE{color:#666666;font-size:8pt;font-weight:BOLD;}
  19.         .ERROR{color:#cc0033;font-size:8pt;font-weight:BOLD;}
  20.         .MENUCELL{height:24px;width:80px;text-align:center;font-weight:BOLD;color:#FFFFFF;border-top:1px solid #BBBBBB;border-bottom:1px solid #BBBBBB;border-right:1px solid #BBBBBB;}
  21.         .MENUCELLSTART{height:24px;width:80px;border:1px solid #BBBBBB;text-align:center;font-weight:BOLD;color:#FFFFFF;}
  22.         .SPACE1{padding-left:20px;}
  23.         .BORDER{background-color:#EEEEEE;color:#666666;border-top:1px solid #BBBBBB;border-bottom:1px solid #BBBBBB;border-right:1px solid #BBBBBB;height:24px;padding-left:16px;}
  24.         .BORDER1{border-bottom:1px solid #BBBBBB;}
  25.         .BORDER2{background-color:#EEEEEE;color:#666666;border:1px solid #BBBBBB;}
  26.         .BORDER3{background-color:#000000;color:#666666;border-top:1px solid #ffffff;border-bottom:1px solid #ffffff;border-right:1px solid #ffffff;height:44px;padding-left:16px;}
  27.         .HEADER{background-color:#EEEEEE;color:#666666;border:1px solid #BBBBBB;height:24px;font-weight:BOLD;padding-left:20px;}
  28.         .PRODCELL{border-left:1px solid #BBBBBB;border-bottom:1px solid #BBBBBB;background-color:#FFFFFF;}
  29.         .HEADER1{background-color:#EEEEEE;color:#666666;border-left:1px solid #BBBBBB;border-top:1px solid #BBBBBB;border-bottom:1px solid #BBBBBB;height:24px;font-weight:BOLD;padding-left:20px;}
  30.         .HEADER5{width:130px;color:#666666;background-color:#EEEEEE;border-top:1px solid #BBBBBB;border-right:1px solid #BBBBBB;height:24px;}
  31.         .PRODIMGLGCELL{width:300px;height:295px;background-color:#EEEEEE;border-left:1px solid #BBBBBB;border-right:1px solid #BBBBBB;border-bottom:1px solid #BBBBBB;vertical-align:top;text-align:center;}
  32.         .PRODIMGSMCELL{width:130px;height:125px;background-color:#EEEEEE;border-left:1px solid #BBBBBB;border-right:1px solid #BBBBBB;border-bottom:1px solid #BBBBBB;vertical-align:top;text-align:center;}
  33.         .PRODIMGSM{border:1px solid white;height:120px;width:120px;align:middle;}
  34.         .PRODIMGLG{border:1px solid #BBBBBB;height:290px;width:290px;align:middle;}
  35.         .CATIMG{width:120px;height:120px;border:1px solid #BBBBBB;}
  36.         .stylegreyblue {color: #669999}
  37.         .stylelightblue {color: ##DEE7F7}
  38.         .styleblack {color:#000000}
  39.         .stylegreyblack {color:#444444}
  40.         .styledarkpink {color: #990033}
  41.         .styleslateblue {color: #008b8b}
  42.         .stylewhite {color: #ffffff}
  43.         .input.btn {color:#666666; font: bold small 'trebuchet ms',helvetica,sans-serif; 
  44.         background-color: #eeeeee;
  45.         border:1px solid;   
  46.         border-color: #66CCFF #66CCFF #66CCFF #66CCFF; 
  47.         font-size:11px; 
  48.         }  
  49.  
  50. //a { 
  51. //    position: right; 
  52. //   top: 5pt ; 
  53. //    left: 10pt ; 
  54. //} 
  55.  
  56. //a2 { 
  57. //    position: left; 
  58. //    top: 80pt ; 
  59. //    left: 80pt ; 
  60. //} 
  61.  
  62.  
  63. .style17 {color: #666666}
  64. .style18 {color: #CC6699}
  65. .style19 {color: #CCCCCC}
  66. .style22 {font-family: Verdana; color: #CCCCCC;}
  67. .style23 {color: #66CCFF}
  68. .style24 {
  69.     color: #99FF66;
  70.     font-weight: bold;
  71. }
  72. .style26 {color: #99FF66}
  73. .style27 {color: #999999}
  74. .stylered {color: #FF0000}
  75. .stylegreen {color: #00FF00}
  76.  
  77. </STYLE>
  78.  
  79.  
  80.  
  81. <SCRIPT LANGUAGE="text/JavaScript">
  82.    function FRESHEN() 
  83.  { 
  84.    window.location.reload();
  85. }
  86. </SCRIPT>
  87.  
  88.  
  89.  
  90. <SCRIPT LANGUAGE="text/JavaScript">
  91.    function go_back_1() 
  92.  { 
  93.    history.go(-1); 
  94. }
  95. </SCRIPT>
  96.  
  97.  
  98.  
  99. <SCRIPT LANGUAGE="text/JavaScript">
  100.    function go_back_2() 
  101.  { 
  102.   history.go(-2); 
  103. }
  104. </SCRIPT>
  105.  
  106.  
  107.  
  108.  
  109. <SCRIPT LANGUAGE="text/JavaScript"> 
  110. function showLoc2() 
  111. var a = document.getElementById("link"); 
  112. a.addEventListener("click", go_back_1, false); 
  113. if (window.location.hash == "#top") 
  114.     a.firstChild.nodeValue = "TWO"; 
  115.     a.removeEventListener("click", go_back_1, false); 
  116.     a.addEventListener("click", go_back_2, false); 
  117. </SCRIPT>
  118.  
  119.  
  120. </head>
  121.  
  122.  
  123.  
  124.  
  125. <BODY onload="showLoc2();">
  126.  
  127.  
  128.  
  129.  
  130.  
  131. <a href  "#" onclick = "go_back_1" id="link">ONE</a>  
  132.  
  133.  
  134.  
  135.  
  136. <?php
  137. $count=$_GET['count'];
  138. $fac= strtoupper($_GET['fac']);
  139. $SRG_GROUP=$_GET['SRG_GROUP'];
  140. ?>
  141.  
  142.  
  143.  
  144.  
  145.  
  146. <br>
  147.  
  148.  
  149.  
  150. <?php
  151.  
  152. #echo $_SERVER['REQUEST_URI']
  153.  
  154. #echo "<a href = 'COUNTTEST.php'>HOME</a><br><br>";
  155.  
  156. echo "<a name=top></a><br>";
  157.  
  158. echo "<A HREF='javascript:javascript:history.go(-1)'>HOME</A><br><br>";
  159.  
  160.  
  161.  
  162.  
  163.  
  164. print "<span style='color: #008b8b; font-size: 20pt; font-family: arial'><b>";
  165.  
  166. echo $count;
  167. echo "<br>";
  168. print "</b></span>";
  169. print "<span class='style17'><font face = 'arial' size = '1'>";
  170. echo $fac;
  171. echo "<br>";
  172. echo $SRG_GROUP;
  173. echo "<br><br>";
  174. print "</font></span>";
  175.  
  176.  
  177. $conn=odbc_connect('ERVOLUMES','','');
  178. if (!$conn)
  179.   {exit("Connection Failed: " . $conn);}
  180.  
  181. $sql="SELECT [patient account number] AS patient_account_number, dischargeday, hospitalcode, age, [discharge time] AS discharge_time FROM 1_shift WHERE SRG_GROUP = '".$SRG_GROUP."' AND hospitalcode LIKE '".$fac."' AND admitday ='".$count."'";
  182.  
  183.  
  184. $rs=odbc_exec($conn,$sql);
  185.  
  186. print "<hr size = 1 width = 400 align = left color = #666666>";
  187. print "<span style='color: #008b8b; font-size: 10pt; font-family: arial'><b>";
  188. echo "details <br>";
  189. print "</b></span>";
  190.  
  191.  
  192. echo "<br><table width = '500' height = '10' align = 'left' border = '0'>";
  193. echo "<tr height = '10'>";
  194. echo "<td width = '100' height = '10'><b>ADMIT DAY</b></td>";
  195. echo "<td width = '100' height = '10'><b>AGE</b></td>";
  196. echo "<td width = '100' height = '10'><b>DISCH DAY</b></td>";
  197. echo "<td width = '100' height = '10'><b>PT ACCT#</b></td>";
  198. echo "<td width = '100' height = '10'><b>DISCH TIME</b></td>";
  199. echo "</tr>";
  200. echo "</table><br>";
  201.  
  202. echo "<br><table width = '500' height = '10' align = 'left' border = '0'>";
  203.  
  204.  
  205. if (!$rs)
  206.   {exit("Error in SQL");}
  207. while (odbc_fetch_row($rs))
  208. {
  209.  
  210.  
  211.   $DISDAY=odbc_result($rs, dischargeday);
  212.   $AGE=odbc_result($rs, age);
  213.   $PTACCTNO=odbc_result($rs, patient_account_number);
  214.   $DISCHTIME=odbc_result($rs, discharge_time);
  215.  
  216.  
  217.  
  218. echo "<tr height = '10'>";
  219. echo "<td width = '100' height = '10'>$count</td>";
  220. echo "<td width = '100' height = '10'>$AGE</td>";
  221. echo "<td width = '100' height = '10'>$DISDAY</td>";
  222. echo "<td width = '100' height = '10'>$PTACCTNO</td>";
  223. echo "<td width = '100' height = '10'>$DISCHTIME</td>";
  224. echo "</tr>";
  225.  
  226.  
  227.  
  228.  
  229. #echo $count;
  230. #echo "&nbsp &nbsp $AGE &nbsp $DISDAY &nbsp $PTACCTNO &nbsp $DISCHTIME<br>";
  231.  
  232.  
  233. }
  234.  
  235.  
  236.  
  237. echo "<tr height = '10'>";
  238. echo "<td width = '100' height = '10'><br><a href='#top' onClick='FRESHEN()'>back to top</a></td>";
  239. echo "<td width = '100' height = '10'>";
  240.  
  241.  
  242.  
  243. echo "<div align = 'right'><SCRIPT LANGUAGE='JavaScript'>";
  244. echo "   function showLoc() ";
  245. echo " { ";
  246. echo "   var x = window.location.hash; ";
  247. echo "if (x == '#top')"; 
  248. echo "{ ";
  249. echo "document.body.innerHTML += '<a href=\'javascript:javascript:history.go(-2)\'>TWO </a>';";
  250. echo "}";
  251. echo "else";
  252. echo "{";
  253. echo "document.body.innerHTML += '<a href=\'javascript:javascript:history.go(-1)\'>ONE</a>';";
  254. echo "}";
  255. echo "}";
  256. echo "</SCRIPT></div>";
  257.  
  258.  
  259. echo "</td>";
  260. echo "<td width = '100' height = '10'></td>";
  261. echo "<td width = '100' height = '10'></td>";
  262. echo "<td width = '100' height = '10'><b></td><br>";
  263. echo "</tr>";
  264.  
  265.  
  266. echo "</table><br><br><br>";
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273. ?>
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287. </html>
  288.  
  289.  
thanks in advance,
geebee
Jan 26 '09 #21
Dormilich
8,658 Expert Mod 8TB
this code worked for me, though I had to refresh it sometimes.
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. function init()
  3. {
  4.     var a = document.getElementById("link");
  5.     a.addEventListener("click", go_back_1, false);
  6.  
  7.     if (window.location.hash == "#top")
  8.     {
  9.         a.firstChild.nodeValue = "TWO";
  10.         a.removeEventListener("click", go_back_1, false);
  11.         a.addEventListener("click", go_back_2, false);
  12.     }
  13. }
  14.  
  15. function go_back_1()
  16. {
  17.      history.go(-1);
  18. }
  19.  
  20.  
  21. function go_back_2()
  22. {
  23.      history.go(-2);
  24. }
  25.  
  26. window.addEventListener("load", init, false);
  27. </script>
  28. // in the document body
  29. <a id="link">ONE</a>
note: this is not IE compatible, but good enough for testing
another note: do not add href and onclick attributes, this might screw up the events.
Jan 26 '09 #22
hsriat
1,654 Expert 1GB
I didn't read the whole conversation, but just an interference:
Expand|Select|Wrap|Line Numbers
  1. <div style="
  2.         position: absolute(or fixed if xhtml strict);
  3.         top: 0px;
  4.         width: 100px;
  5.         padding: 5px 10px;
  6.         text-align: right;"
  7. >
  8. <a href="whatever.php">Whatever</a>
  9. </div>
Feb 14 '09 #23

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Eric W. Holzapfel | last post by:
Hello PHPers, I have just installed RH Linux ES 3.0 (basic) kernel 2.4.21-9.EL, i686, Apache 2.0.X, and php 4.2.X. I have made no changes to the php.ini. I am trying to use the following page...
22
by: Jonathan Snook | last post by:
I've been contemplating what the recommended usage of a "top of page" link should be? Should there only ever be one at the bottom of the page? Should they be sprinkled at various points on the...
10
by: Jeff Thies | last post by:
I'd like to embed navigation instructions in html. This would be so that these pages could be spidered and page links name could be extracted and navigation generated. I'm thinking of...
4
by: crhaynes | last post by:
I'm having trouble with my CSS. My links are black, my hover is orange and my active link is red. When I select a link it turns red but i does not retain that color when the selected page loads. ...
14
by: Don G | last post by:
Within the menu for my site, I have inserted 'class="current"' within the link for the current page. So the link looks somthing link: <li><a href="index.php" class="current">Home</a></li> The...
8
by: CHouck | last post by:
I have what seems to be a simple problem but I can't figure it out. I have a page where I have a link with variables built in which I want to pass through the URL so another page can pick the...
3
by: Rhino | last post by:
Yesterday, I reworked the index on my site - http://sfl.london.on.ca - so that they used list markup and I'm quite pleased with them. However, I'm having a problem with one small aspect of the menu...
8
by: Steve | last post by:
Hi; I had a big link checking job to do and it has been years since I have done anything like that so I found a test page to use that I knew had bad links on it( a friends site ) and I decided...
14
by: Wouter | last post by:
Hi, I try to make the follow. I want that i can click on a text link and that then a link wil be copyed in a input form box (<input type="text" name="img_url" />). I have google-ed about how...
12
by: prashant | last post by:
hi, i am trying to create an xml tag ref to hold link.php?id=1; or link.php?id=2 and so on. I want the links for all the fields(id) in the databse so that when i call them in my html page for...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.