目前分類:Java Script (34)

瀏覽方式: 標題列表 簡短摘要

<SCRIPT LANGUAGE="javascript">
<!--
window.open ('newPage.html', 'newwindow', 'height=100, width=400, top=0, left=0, toolbar=no, menubar=no, scrollbars=no,resizable=no,location=no, status=no')
-->
</SCRIPT>

Roger 發表在 痞客邦 留言(0) 人氣()

<input type="button" value="關閉窗口" onClick="window.opener=null;window.close();">

<a href=javascript:window.opener=null;window.close();>關閉窗口</a>


Roger 發表在 痞客邦 留言(0) 人氣()

由於來源已經不知道了,若有人知道還請告知~~

Web標準下可以通過getElementById(), getElementsByName(), and getElementsByTagName()訪問Documnent中的任一個標籤:

1.getElementById(“ID”)
  getElementById()
可以訪問Documnent中的某一特定元素,顧名思義,就是通過ID來取得元素,所以只能訪問設置了ID的元素。
比如說有一個DIV的ID為docid:

Roger 發表在 痞客邦 留言(0) 人氣()

會自動跳出列印視窗

<script language="javascript">
function print_page() {
    window.print();  
}

Roger 發表在 痞客邦 留言(0) 人氣()

function br(){
alert("第一行\r第二行")
}

==================
執行結果=>

Roger 發表在 痞客邦 留言(0) 人氣()

function IndexDemo(){
   var str1 = "Amount";
   var s = str1.indexOf("m");
   return(s);
}

Roger 發表在 痞客邦 留言(0) 人氣()

<form name="form" method="post" action="index.html">
   <input type="submit" value="送出" />
</form>

button也可以用javascript的方法來實現,以上的範例

<input type="button" value="送出" onclick="self.location.href='index.html'"/>

Roger 發表在 痞客邦 留言(0) 人氣()

 


語法:
oElement = document . elementFromPoint ( iX , iY )
參數:

Roger 發表在 痞客邦 留言(0) 人氣()

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">  
<html>  
<head>  
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">  
<title>打開DIV例子</title>  

Roger 發表在 痞客邦 留言(0) 人氣()

<!--右側漂浮廣告開始 -->
<SCRIPT language="javascript">
document.write("<div id=\"piao\" style=\"background-color:#ffffff; padding:2px; border:#282D24 1px dotted; position:absolute;filter: alpha(opacity=80); \">");
document.write("<a href=http://www.dyzhu.net/><img src=http://www.upasp.cn/ad/dyzhu.gif border=0 /></a>");
document.write("<div style=\"background-color:#f6f6f6; width:100px; height:20px; line-height:22px; text-align:center;\"><a onclick=\"javascript:return closepiao();\">關閉</a></div>");

Roger 發表在 痞客邦 留言(0) 人氣()

在.net世界裡,如果我要格式化日期的話

我只要用tostring的方式就可以了

如果是VB.NET,也可以用FormatDateTime

可是在javascript ,難道就只能慢慢拆解嗎@@

經過我的努力不懈  終於讓我找到了方法

Roger 發表在 痞客邦 留言(0) 人氣()

 1判斷select選項中 是否存在Value="paraValue"的Item

 2向select選項中 加入一個Item

 3從select選項中 刪除一個Item

 4刪除select中選中的項

 5修改select選項中 value="paraValue"的text為"paraText"

Roger 發表在 痞客邦 留言(0) 人氣()

定義和用法
isNaN()
函數用於檢查其參數是否是非數值。

 

語法:
isNaN(x)

 

Roger 發表在 痞客邦 留言(0) 人氣()

<body onkeydown="if(event.keyCode==13) return false;">


Roger 發表在 痞客邦 留言(0) 人氣()

«12