Re: [問題] 請問新手問題 關於網址

看板Ajax作者 (沉默是金。)時間14年前 (2011/03/07 17:04), 編輯推噓2(201)
留言3則, 2人參與, 最新討論串2/2 (看更多)
※ 引述《XAMDOU (薩姆德)》之銘言: : 大家好 初次來這邊 : 想請問有關網址的問題 : 關於「用java script」寫的網頁 : 而內容的連結的部份 我有點疑惑 : 網頁架構大概是這樣(從網址看來) : ======================================================== : domain : ---+--- subdomain1 : | : +--- subdomain2 .. : ... : +--- path : --+--- file1.js : | : +--- file2.js : ======================================================== : 而我在存取 http://domain/subdomain/ooo/xxx/###/$$$.htm 的時候 : 在網頁Header 的部份有類似這樣 : <script language="javascript" src="/path/file1.js"></script> ^ 以/開頭表示從網站根目錄開始 如果去掉這個開頭的 / 剩下的就跟你想的一樣了 這是絕對路徑跟相對路徑的差別 : 這個js卻要在 http://domain/path/file1.js 才找到 : (我原本以為在 http://domain/subdomain/ooo/xxx/###/path/file1.js ) : 請問這個是為什麼? : 他的設定值在哪裡找的? : 為什麼它們裏面的src 值都不是完整的網址碼 : 如果不是完整的話,那應該會有他的root 值(以本例應為 http://domain)可以接上 : 這個設定要去哪裡找? : 由於我是新手 : 很多基礎知識可能不懂 請多多包含 : 想請問有沒有建議參考的東西可以看看 : 光是網址這邊我就焦土政策嘗試很久 : 在此 先感謝各位 <(_._)> -- I am a person, and I am always thinking . Thinking in love , Thinking in life , Thinking in why , Thinking in worth. I can't believe any of what , I am just thinking then thinking , but worst of all , most of mine is thinking not actioning... -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 72.21.245.243

03/07 17:07, , 1F
所以如果是src=path/file1.js 的話, 就是從我想的地方那嗎?
03/07 17:07, 1F

03/07 17:21, , 2F
yep
03/07 17:21, 2F

03/07 17:38, , 3F
非常感謝~~~~~
03/07 17:38, 3F
文章代碼(AID): #1DT9-pdq (Ajax)
討論串 (同標題文章)
文章代碼(AID): #1DT9-pdq (Ajax)