Connecting Tech Pros Worldwide Help | Site Map

link at TOP of page

Member
 
Join Date: Jan 2009
Posts: 59
#1: Jan 22 '09
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
Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,936
#2: Jan 22 '09

re: link at TOP of page


There's a few links in there. Could you be more specific please?
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,629
#3: Jan 22 '09

re: link at TOP of page


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);
Member
 
Join Date: Jan 2009
Posts: 59
#4: Jan 22 '09

re: link at TOP of page


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
Member
 
Join Date: Jan 2009
Posts: 59
#5: Jan 22 '09

re: link at TOP of page


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
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,629
#6: Jan 22 '09

re: link at TOP of page


Quote:

Originally Posted by geraldjr30 View Post

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

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. }
Member
 
Join Date: Jan 2009
Posts: 59
#7: Jan 22 '09

re: link at TOP of page


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
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,629
#8: Jan 22 '09

re: link at TOP of page


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
Member
 
Join Date: Jan 2009
Posts: 59
#9: Jan 22 '09

re: link at TOP of page


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
...
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,629
#10: Jan 22 '09

re: link at TOP of page


Quote:

Originally Posted by geraldjr30 View Post

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...

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?

Quote:

Originally Posted by geraldjr30 View Post

not sure what to do now... forgive my bad writing... still learning this PHP

PHP is not your problem here.........
Member
 
Join Date: Jan 2009
Posts: 59
#11: Jan 22 '09

re: link at TOP of page


Quote:
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
Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,936
#12: Jan 22 '09

re: link at TOP of page


Moving to html/css
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,629
#13: Jan 22 '09

re: link at TOP of page


Quote:

Originally Posted by geraldjr30 View Post

could you give me an example of using the javascript to set the attribute?

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. }
drhowarddrfine's Avatar
Expert
 
Join Date: Sep 2006
Posts: 5,561
#14: Jan 22 '09

re: link at TOP of page


btw, there's no such thing as:
<SCRIPT LANGUAGE="JavaScript">

Should be:
<script type="text/javscript">
Member
 
Join Date: Jan 2009
Posts: 59
#15: Jan 23 '09

re: link at TOP of page


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
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,629
#16: Jan 23 '09

re: link at TOP of page


Quote:

Originally Posted by geraldjr30 View Post

"ONE" is appearing at the tope of the page, but the AOL or MICROSOFDT links are not appearing at all.

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.

Quote:

Originally Posted by geraldjr30 View Post

and the url in the address bar is suffixed with "#top".

you need that to trigger window.location.hash.
Member
 
Join Date: Jan 2009
Posts: 59
#17: Jan 23 '09

re: link at TOP of page


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
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,629
#18: Jan 23 '09

re: link at TOP of page


Quote:

Originally Posted by geraldjr30 View Post

ONE is being listed at the top of the page, but it doesnt appear to be a link.. just a word.

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)
Member
 
Join Date: Jan 2009
Posts: 59
#19: Jan 23 '09

re: link at TOP of page


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
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,629
#20: Jan 23 '09

re: link at TOP of page


Quote:

Originally Posted by geraldjr30 View Post

i am assuming that the javascript code i had in the previous post is supposed to change this link with ID name of "link"?

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
Member
 
Join Date: Jan 2009
Posts: 59
#21: Jan 26 '09

re: link at TOP of page


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
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,629
#22: Jan 26 '09

re: link at TOP of page


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.
hsriat's Avatar
Expert
 
Join Date: Jan 2008
Location: Bath, UK
Posts: 1,609
#23: Feb 14 '09

re: link at TOP of page


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>
Reply