Home > Archives > 2007年12月 > IE6+外部JSにおいてa要素のhref属性を取得すると勝手にデコードされてしまう問題とその解決法
< Older: キミキス pure rouge #11 tear drops | Newer: つれづれ >
IE6+外部JSにおいてa要素のhref属性を取得すると勝手にデコードされてしまう問題とその解決法
IE6+外部JSにおいてa要素のhref属性を取得すると勝手にデコードされてしまう問題とその解決法
■ 現象
IE6+外部JSにおいてa要素のhref属性をelement.hrefもしくはelement.getAttribute("href")のような形で取得すると、URLエンコードされた文字列が勝手にバイナリ文字列にデコードされてしまう。
■ 解決法
element.getAttribute("href", 2)に置き換えれば解決。
■ 参照
getAttribute Method (A, ADDRESS, APPLET, ...) | MSDN Internet Explorer Developer Center
iFlags
Optional. Integer that specifies one or more of the following flags:
- 0
- Default. Performs a property search that is not case-sensitive, and returns an interpolated value if the property is found.
- 1
- Performs a case-sensitive property search. To find a match, the uppercase and lowercase letters in sAttrName must exactly match those in the attribute name. If the iFlags parameter for getAttribute is set to 1 and this option is set to 0 (default), the specified property name might not be found.
- 2
- Returns the value exactly as it was set in script or in the source document.
例によってIE独自規格。
- Category: 個人的メモ
- Tag: JavaScript, Tips
Comment: 0
- Attention
- コメントの受け付けは終了しました。
Trackback: 0
- Attention
- トラックバックの受け付けは終了しました。
< Older: キミキス pure rouge #11 tear drops | Newer: つれづれ >
Home > Archives > 2007年12月 > IE6+外部JSにおいてa要素のhref属性を取得すると勝手にデコードされてしまう問題とその解決法
- Feeds
- Counter
-
-
since 2008.01.11
-